home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / CC_C / 0574.ZIP / STRCHR.ASM < prev    next >
Assembly Source File  |  1986-11-21  |  408b  |  30 lines

  1. include compiler.inc
  2.     ttl    STRCHR, 1.05, 10-21-86 jwk
  3.  
  4. ;string function - returns pointer to char in string
  5.  
  6.     dseg
  7.     cseg
  8.  
  9.     alias    strchr,index
  10.  
  11.     procdef    strchr, <<buffr, ptr>, <targt, word>>
  12.     pushreg
  13.     pushds
  14.     ldptr    si,buffr
  15.     mov    dx,targt
  16.     cld
  17. ndxlp:    lodsb
  18.     or    al,al
  19.     jz    ndxfl
  20.     cmp    al,dl
  21.     jz    ndxit
  22.     jmp    ndxlp
  23. ndxfl:    mov    si,1
  24. ndxit:    dec    si
  25.     clc
  26.     retptrr    si,ds
  27.     pend    strchr
  28.  
  29.     finish
  30.